#!/usr/bin/env python

import sys
import os

from parser import Parser
from htmlwriter import HTMLWriter
from latexwriter import LatexWriter

def run(outputformat):
	if len(sys.argv) != 2:
		print('USAGE: ' + sys.argv[0] + ' inputfile.markdown')
		quit()

	f = open(sys.argv[1])

	writer = None

	if outputformat == 'html':
		writer = HTMLWriter()
	elif outputformat == 'latex':
		writer = LatexWriter()
	else:
		sys.exit(1)

	parser = Parser(writer)
	parser.parse(f.read())
